<template>
  <div class="container vh-100 d-flex justify-content-center align-items-center pb-5">
    <Card title="欢迎注册" class="border-0" header-class="bg-white" footer-class="bg-white">
      <template v-slot:header>
        <h3 class="card-title">欢迎注册</h3>
      </template>
      <CardForm btn-text="注 册" @click="regist" key="regist" />
      <template v-slot:footer>
        <router-link class="btn btn-linke text-secondary" to="/login">如果您已注册账户，请点击此处登录</router-link>
      </template>
    </Card>
  </div>
</template>
<script>
import Card from "@/components/Card";
import CardForm from "@/components/CardForm";

export default {
  name: "Regist",
  components: {
    Card,
    CardForm
  },
  methods: {
    regist(username, password) {
      this.$store.dispatch("regist", {
        username: username,
        password: password
      });
      alert("注册成功");
      this.$router.push({ path: "/login" });
    }
  }
};
</script>